@@ -57,6 +57,7 @@ def encrypt(request):  | 
            ||
| 57 | 57 | 
                marketcode.has_used = True  | 
            
| 58 | 58 | 
                marketcode.save()  | 
            
| 59 | 59 | 
                 | 
            
| 60 | 
                + mieli.application_id = marketcode.application_id  | 
            |
| 60 | 61 | 
                mieli.code = marketcode.code  | 
            
| 61 | 62 | 
                mieli.code_url = marketcode.code_url  | 
            
| 62 | 63 | 
                mieli.brand_pk = brand_pk  | 
            
                @@ -217,11 +218,11 @@ def decrypt2(request):  | 
            ||
| 217 | 218 | 
                     code = code_info.get('code', '')
               | 
            
| 218 | 219 | 
                 | 
            
| 219 | 220 | 
                try:  | 
            
| 220 | 
                - miel = MchInfoEncryptLogInfo.objects.get(code=code)  | 
            |
| 221 | 
                + mieli = MchInfoEncryptLogInfo.objects.get(code=code)  | 
            |
| 221 | 222 | 
                except MchInfoEncryptLogInfo.DoesNotExist:  | 
            
| 222 | 223 | 
                return response()  | 
            
| 223 | 224 | 
                 | 
            
| 224 | 
                - plaintext = miel.plaintext  | 
            |
| 225 | 
                + plaintext = mieli.plaintext  | 
            |
| 225 | 226 | 
                 | 
            
| 226 | 227 | 
                # brand_id#model_id#distributor_id#sn#time  | 
            
| 227 | 228 | 
                # AAAA#AAAAAA#AAAAA#AAAAAAAAAAAAAA#180224  | 
            
                @@ -237,13 +238,18 @@ def decrypt2(request):  | 
            ||
| 237 | 238 | 
                except ModelInfo.DoesNotExist:  | 
            
| 238 | 239 | 
                model = None  | 
            
| 239 | 240 | 
                 | 
            
| 240 | 
                -    mdli, created_at = MchInfoDecryptLogInfo.objects.get_or_create(ciphertext=ciphertext, defaults={
               | 
            |
| 241 | 
                - 'brand_pk': brand_pk,  | 
            |
| 242 | 
                - 'model_pk': model_pk,  | 
            |
| 243 | 
                - 'distributor_pk': distributor_pk,  | 
            |
| 244 | 
                - 'sn': sn,  | 
            |
| 245 | 
                - 'decrypt_count': 1,  | 
            |
| 246 | 
                - })  | 
            |
| 241 | 
                + mdli, created_at = MchInfoDecryptLogInfo.objects.get_or_create(  | 
            |
| 242 | 
                + application_id=mieli.application_id,  | 
            |
| 243 | 
                + code=mieli.code,  | 
            |
| 244 | 
                + code_url=mieli.code_url,  | 
            |
| 245 | 
                +        defaults={
               | 
            |
| 246 | 
                + 'brand_pk': brand_pk,  | 
            |
| 247 | 
                + 'model_pk': model_pk,  | 
            |
| 248 | 
                + 'distributor_pk': distributor_pk,  | 
            |
| 249 | 
                + 'sn': sn,  | 
            |
| 250 | 
                + 'decrypt_count': 1,  | 
            |
| 251 | 
                + }  | 
            |
| 252 | 
                + )  | 
            |
| 247 | 253 | 
                 | 
            
| 248 | 254 | 
                if not created_at:  | 
            
| 249 | 255 | 
                mdli.decrypt_count += 1  | 
            
                @@ -0,0 +1,35 @@  | 
            ||
| 1 | 
                +# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                +# Generated by Django 1.11.26 on 2020-01-14 04:29  | 
            |
| 3 | 
                +from __future__ import unicode_literals  | 
            |
| 4 | 
                +  | 
            |
| 5 | 
                +from django.db import migrations, models  | 
            |
| 6 | 
                +  | 
            |
| 7 | 
                +  | 
            |
| 8 | 
                +class Migration(migrations.Migration):  | 
            |
| 9 | 
                +  | 
            |
| 10 | 
                + dependencies = [  | 
            |
| 11 | 
                +        ('logs', '0006_auto_20200113_1832'),
               | 
            |
| 12 | 
                + ]  | 
            |
| 13 | 
                +  | 
            |
| 14 | 
                + operations = [  | 
            |
| 15 | 
                + migrations.AddField(  | 
            |
| 16 | 
                + model_name='mchinfodecryptloginfo',  | 
            |
| 17 | 
                + name='application_id',  | 
            |
| 18 | 
                + field=models.IntegerField(db_index=True, default=0, help_text='\u7533\u8bf7\u5355\u53f7', verbose_name='application_id'),  | 
            |
| 19 | 
                + ),  | 
            |
| 20 | 
                + migrations.AddField(  | 
            |
| 21 | 
                + model_name='mchinfodecryptloginfo',  | 
            |
| 22 | 
                + name='code',  | 
            |
| 23 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u4e5d\u4f4d\u7684\u5b57\u7b26\u4e32\u539f\u59cb\u7801', max_length=16, null=True, verbose_name='code'),  | 
            |
| 24 | 
                + ),  | 
            |
| 25 | 
                + migrations.AddField(  | 
            |
| 26 | 
                + model_name='mchinfodecryptloginfo',  | 
            |
| 27 | 
                + name='code_url',  | 
            |
| 28 | 
                + field=models.CharField(blank=True, db_index=True, help_text='28\u4f4d\u666e\u901a\u7801\u5b57\u7b26\t', max_length=128, null=True, verbose_name='code_url'),  | 
            |
| 29 | 
                + ),  | 
            |
| 30 | 
                + migrations.AddField(  | 
            |
| 31 | 
                + model_name='mchinfoencryptloginfo',  | 
            |
| 32 | 
                + name='application_id',  | 
            |
| 33 | 
                + field=models.IntegerField(db_index=True, default=0, help_text='\u7533\u8bf7\u5355\u53f7', verbose_name='application_id'),  | 
            |
| 34 | 
                + ),  | 
            |
| 35 | 
                + ]  | 
            
                @@ -19,6 +19,7 @@ class MchInfoEncryptLogInfo(BaseModelMixin):  | 
            ||
| 19 | 19 | 
                sn = models.CharField(_(u'sn'), max_length=32, blank=True, null=True, help_text=u'序列号', db_index=True)  | 
            
| 20 | 20 | 
                 | 
            
| 21 | 21 | 
                # 一物一码  | 
            
| 22 | 
                + application_id = models.IntegerField(_(u'application_id'), default=0, help_text=u'申请单号', db_index=True)  | 
            |
| 22 | 23 | 
                code = models.CharField(_(u'code'), max_length=16, blank=True, null=True, help_text=u'九位的字符串原始码', db_index=True)  | 
            
| 23 | 24 | 
                code_url = models.CharField(_(u'code_url'), max_length=128, blank=True, null=True, help_text=u'28位普通码字符 ', db_index=True)  | 
            
| 24 | 25 | 
                 | 
            
                @@ -74,6 +75,11 @@ class MchInfoDecryptLogInfo(BaseModelMixin):  | 
            ||
| 74 | 75 | 
                 | 
            
| 75 | 76 | 
                sn = models.CharField(_(u'sn'), max_length=32, blank=True, null=True, help_text=u'序列号', db_index=True)  | 
            
| 76 | 77 | 
                 | 
            
| 78 | 
                + # 一物一码  | 
            |
| 79 | 
                + application_id = models.IntegerField(_(u'application_id'), default=0, help_text=u'申请单号', db_index=True)  | 
            |
| 80 | 
                + code = models.CharField(_(u'code'), max_length=16, blank=True, null=True, help_text=u'九位的字符串原始码', db_index=True)  | 
            |
| 81 | 
                + code_url = models.CharField(_(u'code_url'), max_length=128, blank=True, null=True, help_text=u'28位普通码字符 ', db_index=True)  | 
            |
| 82 | 
                +  | 
            |
| 77 | 83 | 
                decrypt_count = models.IntegerField(_(u'decrypt_count'), default=1, help_text=u'解密次数')  | 
            
| 78 | 84 | 
                 | 
            
| 79 | 85 | 
                class Meta:  |